package cloud.dandanit.itservice.service.impl;

import cloud.dandanit.itservice.entity.Hyperlink;
import cloud.dandanit.itservice.mapper.HyperlinkMapper;
import cloud.dandanit.itservice.service.HyperlinkService;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author luokai
 * @since 2022-07-26
 */
@SuppressWarnings("ALL")
@Service
public class HyperlinkServiceImpl extends ServiceImpl<HyperlinkMapper, Hyperlink> implements HyperlinkService {

    @Override
    @Cacheable(key="'getIndexHyperlinkList'", value = "hyperlink")
    public List<Hyperlink> getIndexList() {

        LambdaQueryWrapper<Hyperlink> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.orderByDesc(Hyperlink::getSort);
        List<Hyperlink> hyperlinkList = this.list(queryWrapper);

        return hyperlinkList;
    }
}
